package cn.stylefeng.guns.modular.yingbao.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.yingbao.entity.SysSellSetting;
import cn.stylefeng.guns.modular.yingbao.model.params.SysSellSettingParam;
import cn.stylefeng.guns.modular.yingbao.service.SysSellSettingService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 买入超时设置控制器
 *
 * @author jj
 * @Date 2019-12-13 16:44:49
 */
@Controller
@RequestMapping("/sysSellSetting")
public class SysSellSettingController extends BaseController {

    private String PREFIX = "/sysSellSetting";

    @Autowired
    private SysSellSettingService sysSellSettingService;

    /**
     * 跳转到主页面
     *
     * @author jj
     * @Date 2019-12-13
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/sysSellSetting.html";
    }

    /**
     * 新增页面
     *
     * @author jj
     * @Date 2019-12-13
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/sysSellSetting_add.html";
    }

    /**
     * 编辑页面
     *
     * @author jj
     * @Date 2019-12-13
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/sysSellSetting_edit.html";
    }

    /**
     * 新增接口
     *
     * @author jj
     * @Date 2019-12-13
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(SysSellSettingParam sysSellSettingParam) {
        this.sysSellSettingService.add(sysSellSettingParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author jj
     * @Date 2019-12-13
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(SysSellSettingParam sysSellSettingParam) {
        this.sysSellSettingService.update(sysSellSettingParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author jj
     * @Date 2019-12-13
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(SysSellSettingParam sysSellSettingParam) {
        this.sysSellSettingService.delete(sysSellSettingParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author jj
     * @Date 2019-12-13
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(SysSellSettingParam sysSellSettingParam) {
        SysSellSetting detail = this.sysSellSettingService.getById(sysSellSettingParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author jj
     * @Date 2019-12-13
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(SysSellSettingParam sysSellSettingParam) {
        return this.sysSellSettingService.findPageBySpec(sysSellSettingParam);
    }

}


